# What is Tanki?

Tanki is a terminal flashcard program written in ruby. I wanted a simple
alternative to Anki that ran in the terminal, thus tanki was born.

# How it works

Tanki works by parsing files inside ~/.tanki. Cards are files with .cards
suffix. Cards are put inside decks, which are just folders containing cards.
Decks can be nested to your heart's content.

Here is an example of the syntax:

```text
# A card about Franz-Ferdinand
%
When arch-duke Franz-Ferdinand was killed?
%
28 June 1914
```

The first % marks the beginning of the prompt and the second indicates the
start of the answer. Everything after a # is comment. If you want to input a
hashtag, escape it ('\\#').

After you read a card, tanki will append the following two lines to the card's
source:

```text
# Values for internal tanki use, dont touch them unless you know what you're doing
Stage: 1
LastReview: 2024-05-06
```

This is some metadata regarding the card. Stage indicates your review stage and
LastReview contains the last time you saw this card. Internally, tanki uses
these two values to compute the ealiest date that the card will be marked as
pending.

The stage number is an position on the following sequence:

```text
0 1 1 2 2 3 3 4 4...
```

The value in the sequence is then added to the date to find out the when the
next review should occur.

As you can see, the spacing algorithm is very simple, though that really
shouldn't matter. Research seems to indicate that the complexity of the spacing
algorithm tends to not matter much.

There is not much that can go wrong in a card. Nevertheless mangled metadata or
a missing % can render it unparseable. In that case, you will have to fix it by
hand. Mangled metadata can be fixed by deleting the current one and letting
tanki add it back again, but you will lose your progress. 

# Usage

Calling tanki without arguments will trigger a review of all pending cards.

You can review only specific cards or decks by passing the '-c' (for cards) or
the '-d' (for decks) arguments followed by the cards or decks you wish to
review. These arguments can be combined and there viewed cards will be union of
all the cards found.

You can also use the '-i' flag to skip cards that contains errors, otherwise
tanki will refuse to startup.

# Installation
First, you need to have ruby installed and have a copy of the code (download it
[here](https://notabug.org/paone/kitty-visual/archive/master.tar.gz)).
Installing is left as a matter of taste, I particularly put the repo inside
~/.local/share: 

```text
mv tanki .local/share
```
and them create a symbolic link to it inside ~/.local/bin.

```text
mkdir ~/.local/bin
ln -s ~/.local/share/tanki.rb ~/.local/bin/tanki
```

To add ~/.local/bin to your PATH, if you haven't already, Add the following line
to your ~/.bash\_profile

```text
export PATH="$HOME/.local/bin:$PATH"
```

This will only work when you restart your session, but you can execute that same
line in your terminal instance to start using tanki immeditately.
